﻿using Power.View.Dialog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace Power.ViewModel.Dialog
{
    class AddVideoViewModel : ViewModelBase
    {
        private AddVideo model;
        
        public AddVideoViewModel(AddVideo model)
        {
            this.model = model;
            Close = new RelayCommand(OnClose);
            CloseOK = new RelayCommand(OnCloseOK);
            SelectVideoFile = new RelayCommand(OnSelectVideoFile);
            SelectVideoDescFile = new RelayCommand(OnSelectVideoDescFile);
        }


       
        private void OnClose()
        {
            this.model.DialogResult = false;
            this.model.Close();
        }
        //检测结果上传
        private void OnSelectVideoFile()
        {
            System.Windows.Forms.FolderBrowserDialog openFileDialog = new System.Windows.Forms.FolderBrowserDialog();  //选择文件夹
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//注意，此处一定要手动引入System.Window.Forms空间，否则你如果使用默认的DialogResult会发现没有OK属性
            {
                this.model.txtVideoFile.Text = openFileDialog.SelectedPath;
            }
        }
        private void OnSelectVideoDescFile()
        {
            System.Windows.Forms.FolderBrowserDialog openFileDialog = new System.Windows.Forms.FolderBrowserDialog();  //选择文件夹
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)//注意，此处一定要手动引入System.Window.Forms空间，否则你如果使用默认的DialogResult会发现没有OK属性
            {
                this.model.txtVideoDescFile.Text = openFileDialog.SelectedPath;
            }
        }
        private void OnCloseOK()
        {
            this.model.DialogResult = true;
            this.model.Close();
        }
       
        #region 
        public RelayCommand Close { get; private set; }

        public RelayCommand SelectVideoFile { get; private set; }

        public RelayCommand CloseOK { get; private set; }
        public RelayCommand SelectVideoDescFile { get; private set; }
        #endregion
    }
}
